﻿using System;
using System.Configuration;
using Common;
using Dal;

public partial class WeiBoAccount : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;
        var o = Request.QueryString["o"];
        if (Request.Cookies["tbuid"]==null)
        {
            Response.Redirect("/WeiBoTuiGUang.aspx");
        }
        string TBuid = Request.Cookies["tbuid"].Value;
        if (!string.IsNullOrEmpty(o))
        {
            new WeiBoUser().Delete(long.Parse(TBuid), o);
        }
        var dt = new WeiBoUser().GetList("tbuid="+TBuid);
        rptLists.DataSource = dt.DefaultView.ToTable();
        rptLists.DataBind();
    }
    protected void BtnQQ_Click(object sender, EventArgs e)
    {
        int maxWeiBoUserCount = int.Parse(ConfigurationManager.AppSettings["MaxWeiBoUserCount"]);
        string TBuid = Request.Cookies["tbuid"].Value;
        if (maxWeiBoUserCount <= new WeiBoUser().GetCount(TBuid))
        {
            JsUtil.MessageBox("您已经绑定了" + maxWeiBoUserCount + "个,达到了上限！", Page);
            return;
        }
        var service = new QQService();
        Response.Redirect(service.GetCodeUrl());
    }
}